/*
 * @Description: 
 * @Author: fhw
 * @Date: 2022-11-18 17:41:01
 */
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'
import { IsDefined, IsNotEmpty, IsString } from 'class-validator'
import { IdDto, PageDto } from '../../common/dto/dto'

export class ChatUserGroupPageDto {
    @ApiPropertyOptional({
        type: String,
        name: 'group_id',
        description: '群聊ID',
    })
    public readonly group_id?: string

    @ApiPropertyOptional({
        type: Number,
        name: 'is_management',
        description: '是否是管理员：1是，0不是',
    })
    public readonly is_management?: number

    @ApiPropertyOptional({
        type: Number,
        name: 'is_join',
        description: '是否加入：0发起邀请，1加入，2拒绝，3申请中',
    })
    public readonly is_join?: number

    @ApiPropertyOptional({
        type: Number,
        name: 'pageSize',
        description: 'pageSize',
    })
    public pageSize?: number
    @ApiPropertyOptional({
        type: Number,
        name: 'pageNum',
        description: 'pageNum',
    })
    public pageNum?: number
}
export class CreateChatUserGroupDto {
    @IsDefined({ message: '群聊ID不能为空' })
    @IsNotEmpty({ message: '群聊ID不能为空' })
    @IsString({ message: '群聊ID不是String类型' })
    @ApiProperty({
        type: String,
        name: 'group_id',
        description: '群聊ID',
    })
    public readonly group_id: string

    @IsDefined({ message: '用户ID不能为空' })
    @IsNotEmpty({ message: '用户ID不能为空' })
    @ApiProperty({
        type: Number,
        name: 'userId',
        description: '用户ID',
    })
    public readonly userId: number

    @IsDefined({ message: '创建者ID不能为空' })
    @IsNotEmpty({ message: '创建者ID不能为空' })
    @ApiProperty({
        type: Number,
        name: 'manager_id',
        description: '创建者ID',
    })
    public readonly manager_id?: number

    @ApiPropertyOptional({
        type: Number,
        name: 'is_join',
        description: '是否加入：0发起邀请，1加入，2拒绝，3申请中',
    })
    public is_join?: number
}
export class UpdateChatUserGroupDto {
    @IsDefined({ message: 'is_join不能为空' })
    @IsNotEmpty({ message: 'is_join不能为空' })
    @ApiProperty({
        type: Number,
        name: 'is_join',
        description: '是否加入：0发起邀请，1加入，2拒绝，3申请中',
    })
    public readonly is_join?: number

    @IsDefined({ message: '用户ID不能为空' })
    @IsNotEmpty({ message: '用户ID不能为空' })
    @ApiProperty({
        type: Number,
        name: 'userId',
        description: '用户ID',
    })
    public readonly userId?: number

    @IsDefined({ message: '群聊ID不能为空' })
    @IsNotEmpty({ message: '群聊ID不能为空' })
    @IsString({ message: '群聊ID不是String类型' })
    @ApiProperty({
        type: String,
        name: 'group_id',
        description: '群聊ID',
    })
    public readonly group_id?: string
}
export class AddChatUserGroupDto {

    @IsDefined({ message: '群聊ID不能为空' })
    @IsNotEmpty({ message: '群聊ID不能为空' })
    @IsString({ message: '群聊ID不是String类型' })
    @ApiProperty({
        type: String,
        name: 'group_id',
        description: '群聊ID',
    })
    public readonly group_id: string

    @IsDefined({ message: '用户ID不能为空' })
    @IsNotEmpty({ message: '用户ID不能为空' })
    @ApiProperty({
        type: Number,
        name: 'userId',
        description: '用户ID',
    })
    public readonly userId: number
}
export class InviteAddChatUserGroupDto extends AddChatUserGroupDto {
    @IsDefined({ message: '邀请人ID不能为空' })
    @IsNotEmpty({ message: '邀请人ID不能为空' })
    @ApiProperty({
        type: Number,
        name: 'inviterId',
        description: '邀请人ID',
    })
    public readonly inviterId: number

}
export class ApplyAddChatUserGroupDto extends AddChatUserGroupDto {
    @ApiPropertyOptional({
        type: String,
        name: 'content',
        description: '申请内容',
    })
    public readonly content: string
}